package mn.more.wits.client.exception;

import com.google.gwt.user.client.rpc.IsSerializable;

/**
 * general security-related exception.
 *
 * @author <a href="mailto:mike.liu@aptechmongolia.edu.mn">Mike Liu</a>
 * @version $Revision: 119 $
 */
public class WitsSecurityException extends Exception implements IsSerializable {

	public static final int ERROR_ALREADY_IN_SESSION = 2;
	public static final int ERROR_ACCOUNT_DISABLED = 4;
	public static final int ERROR_ALREADY_LOGGED_IN = 8;
	public static final int ERROR_ACCOUNT_LOCKED_OUT = 16;
	public static final int ERROR_LOGIN_REQUIRED = 32;
	public static final int ERROR_GENERAL = 255;

	private String message;
	private Throwable cause;

	public WitsSecurityException() { }

	public WitsSecurityException(String message) {
		super(message);
		this.message = message;
	}

	public WitsSecurityException(String message, Throwable cause) {
		super(message, cause);
		this.message = message;
		this.cause = cause;
	}

	public WitsSecurityException(Throwable cause) {
		super(cause);
		this.cause = cause;
	}

	public String getMessage() {
		return message;
	}

	public Throwable getCause() { return cause; }

	public int getErrorCode() { return ERROR_GENERAL; }
}
